package cc.ilzy.mall.api.controller;

import cc.ilzy.mall.model.request.CartItemRequest;
import cc.ilzy.mall.model.vo.CartVO;
import cc.ilzy.mall.utils.ApiResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

@Api(value = "购物车模块", tags = "购物车模块")
@RequestMapping("/api/cart/v1")
public interface ICartController {

    @ApiOperation(value = "添加到购物车", notes = "添加商品到购物车")
    @PostMapping("/add")
    ApiResponse<Void> addCart(@RequestBody CartItemRequest cartItemRequest);

    @ApiOperation(value = "清空用户购物车", notes = "清空当前用户的购物车")
    @GetMapping("/clear")
    ApiResponse<Void> clearCart();


    @ApiOperation(value = "获取我的购物车列表", notes = "获取我的购物车列表")
    @GetMapping("/mycart")
    ApiResponse<CartVO> getMyCart();


    @ApiOperation(value = "删除购物车商品", notes = "删除指定商品的购物车项")
    @DeleteMapping("/delete/{productId}")
    ApiResponse<Void> deleteCart(@PathVariable("productId") Long productId);


    @ApiOperation(value = "修改购物车商品数量", notes = "修改指定商品的购物车数量")
    @PostMapping("/change")
    ApiResponse<Void> changeCartItemNum(@RequestBody CartItemRequest cartItemRequest);
}
